unit ballUnit;

interface

uses ExtCtrls, common;

const R = 5;
      V = 10;

type
  Ball = class
    h : integer;
    x, y : double;
    vx, vy : double;
    constructor Create(_x, _y, _h : integer);
    procedure Draw(im : TImage);
    procedure move;
  end;

implementation

{ Ball }

constructor Ball.Create(_x, _y, _h: integer);
var center : double;
begin
  h := _h;
  x := _x;
  y := _y;
  vx := 0;
  vy := -v;
end;

procedure Ball.Draw(im: TImage);
begin
  im.Canvas.Ellipse(round(x-R), round(y-R), round(x+R), round(y+R));
  im.Canvas.MoveTo(round(x+R), round(y));
  im.Canvas.LineTo(round(x+R), round(y-h));
end;

procedure Ball.move;
begin
  x := x + vx;
  y := y + vy;
end;

end.
